<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.1.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/hexo/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/hexo/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/hexo/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/hexo/images/logo.svg" color="#222">

<link rel="stylesheet" href="/hexo/css/main.css">


<link rel="stylesheet" href="/hexo/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"youchen12138.gitee.io","root":"/hexo/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta property="og:type" content="website">
<meta property="og:title" content="幽辰的博客">
<meta property="og:url" content="https://youchen12138.gitee.io/hexo/page/4/index.html">
<meta property="og:site_name" content="幽辰的博客">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="幽辰">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://youchen12138.gitee.io/hexo/page/4/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : true,
    isPost : false,
    lang   : 'en'
  };
</script>

  <title>幽辰的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/hexo/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">幽辰的博客</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/hexo/" rel="section"><i class="fa fa-home fa-fw"></i>Home</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/hexo/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>Tags<span class="badge">23</span></a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/hexo/categories/" rel="section"><i class="fa fa-th fa-fw"></i>Categories<span class="badge">14</span></a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/hexo/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>Archives<span class="badge">127</span></a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content index posts-expand">
            
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/09/01/canvas-%E5%8A%A8%E7%94%BB/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/hexo/2020/09/01/canvas-%E5%8A%A8%E7%94%BB/" class="post-title-link" itemprop="url">canvas-动画</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>
              

              <time title="Created: 2020-09-01 00:12:04 / Modified: 00:12:36" itemprop="dateCreated datePublished" datetime="2020-09-01T00:12:04+08:00">2020-09-01</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/HTML/" itemprop="url" rel="index"><span itemprop="name">HTML</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/** <span class="doctag">@type <span class="type">&#123;HTMLCanvasElement&#125;</span> </span>*/</span></span><br><span class="line"><span class="keyword">const</span> canvas = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;canvas&#x27;</span>)</span><br><span class="line"><span class="keyword">const</span> ctx = canvas.getContext(<span class="string">&#x27;2d&#x27;</span>)</span><br><span class="line">canvas.width = <span class="number">600</span>;</span><br><span class="line">canvas.height = <span class="number">600</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">let</span> posx = <span class="number">0</span>,</span><br><span class="line">    posy = <span class="number">0</span>,</span><br><span class="line">    isMouseInRect = <span class="literal">false</span>;</span><br><span class="line"></span><br><span class="line">canvas.onmousemove = <span class="function">(<span class="params">e</span>) =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">const</span> mouseX = e.offsetX,</span><br><span class="line">        mouseY = e.offsetY;</span><br><span class="line">    <span class="keyword">if</span> (mouseX &gt; posx &amp;&amp; mouseX &lt; posx + <span class="number">50</span> &amp;&amp; mouseY &gt; posy &amp;&amp; mouseY &lt; posy + <span class="number">50</span>) &#123;</span><br><span class="line">        isMouseInRect = <span class="literal">true</span></span><br><span class="line">    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">        isMouseInRect = <span class="literal">false</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"><span class="built_in">setInterval</span>(<span class="function">() =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">if</span> (!isMouseInRect) &#123;</span><br><span class="line">        posx += <span class="number">10</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    ctx.clearRect(<span class="number">0</span>, <span class="number">0</span>, canvas.width, canvas.height)</span><br><span class="line">    ctx.fillRect(posx, posy, <span class="number">50</span>, <span class="number">50</span>);</span><br><span class="line">    <span class="keyword">if</span> (posx &gt;= canvas.width) &#123;</span><br><span class="line">        posx = <span class="number">-50</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;, <span class="number">100</span>);</span><br></pre></td></tr></table></figure>


      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/08/31/canvas-%E5%89%AA%E8%BE%91%E3%80%81%E9%98%B4%E5%BD%B1%E5%92%8C%E6%9B%B2%E7%BA%BF%E7%BB%98%E5%88%B6/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/hexo/2020/08/31/canvas-%E5%89%AA%E8%BE%91%E3%80%81%E9%98%B4%E5%BD%B1%E5%92%8C%E6%9B%B2%E7%BA%BF%E7%BB%98%E5%88%B6/" class="post-title-link" itemprop="url">canvas-剪辑、阴影和曲线绘制</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2020-08-31 21:38:19" itemprop="dateCreated datePublished" datetime="2020-08-31T21:38:19+08:00">2020-08-31</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2020-09-01 00:12:18" itemprop="dateModified" datetime="2020-09-01T00:12:18+08:00">2020-09-01</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/HTML/" itemprop="url" rel="index"><span itemprop="name">HTML</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h3 id="剪辑"><a href="#剪辑" class="headerlink" title="剪辑"></a>剪辑</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">ctx.arc(<span class="number">300</span>, <span class="number">100</span>, <span class="number">200</span>, <span class="number">0</span>, <span class="built_in">Math</span>.PI * <span class="number">2</span>, <span class="literal">true</span>) <span class="comment">// 剪辑的区域</span></span><br><span class="line">ctx.clip() <span class="comment">// 剪辑</span></span><br><span class="line">ctx.fillStyle = <span class="string">&#x27;red&#x27;</span></span><br><span class="line">ctx.fillRect(<span class="number">100</span>, <span class="number">100</span>, <span class="number">200</span>, <span class="number">200</span>)</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_21-46-30.png" style="zoom:33%;" />

<p><strong>注：</strong> 可以通过 <code>ctx.save()</code> 和 <code>ctx.restore()</code> 来恢复环境</p>
<h3 id="阴影"><a href="#阴影" class="headerlink" title="阴影"></a>阴影</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">ctx.shadowOffsetX = <span class="number">10</span></span><br><span class="line">ctx.shadowOffsetY = <span class="number">10</span></span><br><span class="line">ctx.shadowColor = <span class="string">&#x27;grey&#x27;</span></span><br><span class="line">ctx.shadowBlur = <span class="number">10</span></span><br><span class="line">ctx.fillStyle = <span class="string">&#x27;red&#x27;</span></span><br><span class="line">ctx.fillRect(<span class="number">100</span>, <span class="number">100</span>, <span class="number">100</span>, <span class="number">100</span>)</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_21-58-50.png" style="zoom:33%;" />

<h3 id="贝塞尔曲线"><a href="#贝塞尔曲线" class="headerlink" title="贝塞尔曲线"></a>贝塞尔曲线</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">ctx.beginPath();</span><br><span class="line">ctx.moveTo(<span class="number">150</span>, <span class="number">250</span>);</span><br><span class="line">ctx.quadraticCurveTo(<span class="number">239</span>, <span class="number">89</span>, <span class="number">450</span>, <span class="number">250</span>);</span><br><span class="line">ctx.stroke();</span><br></pre></td></tr></table></figure>


      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/08/31/canvas-%E6%96%87%E6%9C%AC%E5%92%8C%E5%9B%BE%E7%89%87/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/hexo/2020/08/31/canvas-%E6%96%87%E6%9C%AC%E5%92%8C%E5%9B%BE%E7%89%87/" class="post-title-link" itemprop="url">canvas-文本和图片</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>
              

              <time title="Created: 2020-08-31 21:11:21 / Modified: 21:37:32" itemprop="dateCreated datePublished" datetime="2020-08-31T21:11:21+08:00">2020-08-31</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/HTML/" itemprop="url" rel="index"><span itemprop="name">HTML</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h3 id="文本"><a href="#文本" class="headerlink" title="文本"></a>文本</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> str = <span class="string">&#x27;hello world&#x27;</span></span><br><span class="line">ctx.font = <span class="string">&#x27;50px sans-serif&#x27;</span> <span class="comment">// 设置文本样式，比如大小字体</span></span><br><span class="line">ctx.textAlign = <span class="string">&#x27;center&#x27;</span> <span class="comment">// 水平对齐设置，left，center，right</span></span><br><span class="line">ctx.textBaseline = <span class="string">&#x27;top&#x27;</span> <span class="comment">// 垂直对齐设置：top，middle，bottom</span></span><br><span class="line">ctx.fillText(str, <span class="number">300</span>, <span class="number">0</span>) <span class="comment">// 填充文本</span></span><br><span class="line">ctx.strokeText(str, <span class="number">0</span>, <span class="number">200</span>) <span class="comment">// 描边文本</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> width = ctx.measureText(str).width <span class="comment">// 获取文本的宽度</span></span><br><span class="line"><span class="built_in">console</span>.log(width)</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_21-13-01.png" style="zoom:33%;" />

<h3 id="图片"><a href="#图片" class="headerlink" title="图片"></a>图片</h3><h4 id="1-在画布上定位图像："><a href="#1-在画布上定位图像：" class="headerlink" title="1. 在画布上定位图像："></a>1. 在画布上定位图像：</h4><blockquote>
<p>context.drawImage(img, x, y);</p>
</blockquote>
<h4 id="2-在画布上定位图像，并规定图像的宽度和高度："><a href="#2-在画布上定位图像，并规定图像的宽度和高度：" class="headerlink" title="2. 在画布上定位图像，并规定图像的宽度和高度："></a>2. 在画布上定位图像，并规定图像的宽度和高度：</h4><blockquote>
<p>context.drawImage(img, x, y, width, height);</p>
</blockquote>
<h4 id="3-剪切图像，并在画布上定位被剪切的部分："><a href="#3-剪切图像，并在画布上定位被剪切的部分：" class="headerlink" title="3.剪切图像，并在画布上定位被剪切的部分："></a>3.剪切图像，并在画布上定位被剪切的部分：</h4><blockquote>
<p>context.drawImage(img, sx, sy, swidth, sheight, x, y, width, height);</p>
</blockquote>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> img = <span class="keyword">new</span> Image()</span><br><span class="line">img.src = <span class="string">&#x27;./timg.jpg&#x27;</span></span><br><span class="line"><span class="comment">// 一定要在图像加载完成后绘制图像</span></span><br><span class="line">img.onload = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">    <span class="comment">// 从(0, 0)处获取img图形的宽为40，高为40的区域，放置在(0, 0)，缩放为宽为80，高为80的大小</span></span><br><span class="line">    ctx.drawImage(img, <span class="number">0</span>, <span class="number">0</span>, <span class="number">40</span>, <span class="number">40</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">80</span>, <span class="number">80</span>)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="图形画刷"><a href="#图形画刷" class="headerlink" title="图形画刷"></a>图形画刷</h3><ul>
<li>repeat</li>
<li>repeat-x</li>
<li>repeat-y</li>
<li>no-repeat</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> img = <span class="keyword">new</span> Image()</span><br><span class="line">img.src = <span class="string">&#x27;./timg.jpg&#x27;</span></span><br><span class="line">img.onload = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">    <span class="keyword">const</span> pattern = ctx.createPattern(img, <span class="string">&#x27;repeat&#x27;</span>)</span><br><span class="line">    ctx.fillStyle = pattern</span><br><span class="line">    ctx.fillRect(<span class="number">0</span>, <span class="number">0</span>, canvas.width, canvas.height)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_21-36-38.png" style="zoom:33%;" />
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/08/31/canvas-%E6%B8%90%E5%8F%98/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/hexo/2020/08/31/canvas-%E6%B8%90%E5%8F%98/" class="post-title-link" itemprop="url">canvas-渐变</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>
              

              <time title="Created: 2020-08-31 20:23:49 / Modified: 20:56:51" itemprop="dateCreated datePublished" datetime="2020-08-31T20:23:49+08:00">2020-08-31</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/HTML/" itemprop="url" rel="index"><span itemprop="name">HTML</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h3 id="线性渐变"><a href="#线性渐变" class="headerlink" title="线性渐变"></a>线性渐变</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> linearGradient =  ctx.createLinearGradient(<span class="number">50</span>, <span class="number">50</span>, <span class="number">150</span>, <span class="number">150</span>)</span><br><span class="line">linearGradient.addColorStop(<span class="number">0</span>, <span class="string">&#x27;red&#x27;</span>)</span><br><span class="line">linearGradient.addColorStop(<span class="number">1</span>, <span class="string">&#x27;blue&#x27;</span>)</span><br><span class="line">ctx.fillStyle = linearGradient;</span><br><span class="line">ctx.fillRect(<span class="number">0</span>, <span class="number">0</span>, <span class="number">200</span>, <span class="number">200</span>)</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_20-29-23.png" style="zoom:33%;" />

<p><strong>注：</strong> 如果所花区域超过线性渐变，则其余区域的渐变色为端点的颜色</p>
<h3 id="径向渐变"><a href="#径向渐变" class="headerlink" title="径向渐变"></a>径向渐变</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">ctx.save()</span><br><span class="line">ctx.translate(<span class="number">50</span>, <span class="number">50</span>)</span><br><span class="line"><span class="keyword">const</span> linearGradient = ctx.createLinearGradient(<span class="number">-50</span>, <span class="number">-50</span>, <span class="number">50</span>, <span class="number">50</span>)</span><br><span class="line">linearGradient.addColorStop(<span class="number">0</span>, <span class="string">&#x27;orange&#x27;</span>)</span><br><span class="line">linearGradient.addColorStop(<span class="number">0.5</span>, <span class="string">&#x27;#FF6699&#x27;</span>)</span><br><span class="line">linearGradient.addColorStop(<span class="number">1</span>, <span class="string">&#x27;blue&#x27;</span>)</span><br><span class="line">ctx.arc(<span class="number">0</span>, <span class="number">0</span>, <span class="number">50</span>, <span class="number">0</span>, <span class="built_in">Math</span>.PI * <span class="number">2</span>, <span class="literal">true</span>)</span><br><span class="line">ctx.fillStyle = linearGradient;</span><br><span class="line">ctx.fill()</span><br><span class="line"></span><br><span class="line">ctx.restore()</span><br><span class="line"><span class="keyword">const</span> radialGradient = ctx.createRadialGradient(<span class="number">400</span>, <span class="number">150</span>, <span class="number">0</span>, <span class="number">400</span>, <span class="number">150</span>, <span class="number">100</span>)</span><br><span class="line">radialGradient.addColorStop(<span class="number">0</span>, <span class="string">&#x27;red&#x27;</span>)</span><br><span class="line">radialGradient.addColorStop(<span class="number">1</span>, <span class="string">&#x27;blue&#x27;</span>)</span><br><span class="line">ctx.fillStyle = radialGradient</span><br><span class="line">ctx.beginPath();</span><br><span class="line">ctx.arc(<span class="number">400</span>, <span class="number">150</span>, <span class="number">100</span>, <span class="number">0</span>, <span class="built_in">Math</span>.PI * <span class="number">2</span>, <span class="literal">true</span>)</span><br><span class="line">ctx.fill()</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_20-53-05.png" style="zoom:33%;" />
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/08/31/canvas-save%E5%92%8Crestore/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/hexo/2020/08/31/canvas-save%E5%92%8Crestore/" class="post-title-link" itemprop="url">canvas-save和restore</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>
              

              <time title="Created: 2020-08-31 20:04:58 / Modified: 20:17:03" itemprop="dateCreated datePublished" datetime="2020-08-31T20:04:58+08:00">2020-08-31</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/HTML/" itemprop="url" rel="index"><span itemprop="name">HTML</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h4 id="原图案"><a href="#原图案" class="headerlink" title="原图案"></a>原图案</h4><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">ctx.translate(<span class="number">0</span>, <span class="number">100</span>)</span><br><span class="line">ctx.rotate(<span class="built_in">Math</span>.PI / <span class="number">4</span>)</span><br><span class="line">ctx.beginPath()</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineWidth = <span class="number">5</span></span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;green&#x27;</span></span><br><span class="line">ctx.stroke()</span><br><span class="line"></span><br><span class="line">ctx.scale(<span class="number">1</span>, <span class="number">0.5</span>) <span class="comment">// 将x轴方向压缩为原来的1倍，将y轴方向压缩为原来的0.5倍</span></span><br><span class="line">ctx.fillRect(<span class="number">0</span>, <span class="number">-100</span>, <span class="number">100</span>, <span class="number">100</span>)</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_20-00-01.png" style="zoom:33%;" />

<p>我们可以看到当代码进行到这里，canvas的坐标原点已经变的很离谱了，我们在写后续代码时也需要考虑到之前的坐标平移（旋转和缩放），那么，怎么解决这个问题呢，这就需要 <code>save</code> 和 <code>restore</code> 方法来解决这个问题了</p>
<h3 id="使用save-和restore之后"><a href="#使用save-和restore之后" class="headerlink" title="使用save 和restore之后"></a>使用save 和restore之后</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">ctx.save() <span class="comment">// 保存一份环境</span></span><br><span class="line"></span><br><span class="line">ctx.translate(<span class="number">0</span>, <span class="number">100</span>)</span><br><span class="line">ctx.rotate(<span class="built_in">Math</span>.PI / <span class="number">4</span>)</span><br><span class="line">ctx.beginPath()</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineWidth = <span class="number">5</span></span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;green&#x27;</span></span><br><span class="line">ctx.stroke()</span><br><span class="line"></span><br><span class="line">ctx.scale(<span class="number">1</span>, <span class="number">0.5</span>)</span><br><span class="line">ctx.fillRect(<span class="number">0</span>, <span class="number">-100</span>, <span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line"></span><br><span class="line">ctx.restore() <span class="comment">// 恢复环境</span></span><br><span class="line"></span><br><span class="line">ctx.beginPath()</span><br><span class="line">ctx.moveTo(<span class="number">200</span>, <span class="number">200</span>)</span><br><span class="line">ctx.lineTo(<span class="number">300</span>, <span class="number">300</span>)</span><br><span class="line">ctx.stroke()</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_20-09-55.png" alt="image-20200831201012606" style="zoom:33%;" />

<p><strong>注：</strong> 使用 <code>save</code> 和 <code>restore</code> 不仅可以保存图形变换（平移、旋转和缩放）的环境，还可以保存设置的样式的环境</p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/08/31/canvas-%E5%9B%BE%E5%BD%A2%E5%8F%98%E6%8D%A2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/hexo/2020/08/31/canvas-%E5%9B%BE%E5%BD%A2%E5%8F%98%E6%8D%A2/" class="post-title-link" itemprop="url">canvas-图形变换</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>
              

              <time title="Created: 2020-08-31 19:40:46 / Modified: 20:17:15" itemprop="dateCreated datePublished" datetime="2020-08-31T19:40:46+08:00">2020-08-31</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/HTML/" itemprop="url" rel="index"><span itemprop="name">HTML</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h3 id="平移"><a href="#平移" class="headerlink" title="平移"></a>平移</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">ctx.translate(<span class="number">0</span>, <span class="number">100</span>) <span class="comment">// 将坐标系原点平移到(0, 100)</span></span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>) <span class="comment">// 实际上绘制原点(0, 100)</span></span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>) <span class="comment">// 实际上绘制终点(100, 200)</span></span><br><span class="line">ctx.stroke();</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_19-44-02.png" alt="image-20200831194435148" style="zoom:33%;" />

<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>) <span class="comment">// 先绘制点(0, 0)</span></span><br><span class="line">ctx.translate(<span class="number">0</span>, <span class="number">100</span>) <span class="comment">// 再将坐标系原点移动到(0, 100)</span></span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>) <span class="comment">// 实际上到达的点为(0, 200)</span></span><br><span class="line">ctx.stroke();</span><br></pre></td></tr></table></figure>



<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_19-44-16.png" style="zoom:33%;" />

<p><strong>注：</strong> <code>ctx.baginPath()</code> 不会清除掉 <code>ctx.translate()</code> 的平移坐标原点的效果</p>
<h3 id="旋转"><a href="#旋转" class="headerlink" title="旋转"></a>旋转</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">ctx.rotate(<span class="built_in">Math</span>.PI / <span class="number">4</span>) <span class="comment">// 将坐标系顺时针方向旋转45度</span></span><br><span class="line">ctx.beginPath()</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineWidth = <span class="number">5</span></span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;green&#x27;</span></span><br><span class="line">ctx.stroke()</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_19-53-40.png" alt="image-20200831195412450" style="zoom:33%;" />

<h3 id="缩放"><a href="#缩放" class="headerlink" title="缩放"></a>缩放</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">ctx.translate(<span class="number">0</span>, <span class="number">100</span>)</span><br><span class="line">ctx.rotate(<span class="built_in">Math</span>.PI / <span class="number">4</span>)</span><br><span class="line">ctx.beginPath()</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineWidth = <span class="number">5</span></span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;green&#x27;</span></span><br><span class="line">ctx.stroke()</span><br><span class="line"></span><br><span class="line">ctx.fillRect(<span class="number">0</span>, <span class="number">-100</span>, <span class="number">100</span>, <span class="number">100</span>)</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_19-59-40.png" style="zoom:33%;" />

<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">ctx.translate(<span class="number">0</span>, <span class="number">100</span>)</span><br><span class="line">ctx.rotate(<span class="built_in">Math</span>.PI / <span class="number">4</span>)</span><br><span class="line">ctx.beginPath()</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineWidth = <span class="number">5</span></span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;green&#x27;</span></span><br><span class="line">ctx.stroke()</span><br><span class="line"></span><br><span class="line">ctx.scale(<span class="number">1</span>, <span class="number">0.5</span>) <span class="comment">// 将x轴方向压缩为原来的1倍，将y轴方向压缩为原来的0.5倍</span></span><br><span class="line">ctx.fillRect(<span class="number">0</span>, <span class="number">-100</span>, <span class="number">100</span>, <span class="number">100</span>)</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_20-00-01.png" style="zoom:33%;" />
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/08/31/canvas-%E5%A1%AB%E5%85%85%E4%B8%8E%E6%8F%8F%E8%BE%B9/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/hexo/2020/08/31/canvas-%E5%A1%AB%E5%85%85%E4%B8%8E%E6%8F%8F%E8%BE%B9/" class="post-title-link" itemprop="url">canvas-填充与描边</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>
              

              <time title="Created: 2020-08-31 19:21:26 / Modified: 20:17:29" itemprop="dateCreated datePublished" datetime="2020-08-31T19:21:26+08:00">2020-08-31</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/HTML/" itemprop="url" rel="index"><span itemprop="name">HTML</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h3 id="填充"><a href="#填充" class="headerlink" title="填充"></a>填充</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> canvas = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;canvas&#x27;</span>)</span><br><span class="line"><span class="keyword">const</span> ctx = canvas.getContext(<span class="string">&#x27;2d&#x27;</span>)</span><br><span class="line">canvas.width = <span class="number">600</span>;</span><br><span class="line">canvas.height = <span class="number">600</span>;</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">200</span>)</span><br><span class="line">ctx.fill()</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_19-29-20.png" alt="image-20200831192956184" style="zoom:33%;" />

<h3 id="描边"><a href="#描边" class="headerlink" title="描边"></a>描边</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/** <span class="doctag">@type <span class="type">&#123;HTMLCanvasElement&#125;</span> </span>*/</span></span><br><span class="line"><span class="keyword">const</span> canvas = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;canvas&#x27;</span>)</span><br><span class="line"><span class="keyword">const</span> ctx = canvas.getContext(<span class="string">&#x27;2d&#x27;</span>)</span><br><span class="line">canvas.width = <span class="number">600</span>;</span><br><span class="line">canvas.height = <span class="number">600</span>;</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">200</span>)</span><br><span class="line">ctx.closePath();</span><br><span class="line">ctx.lineWidth = <span class="number">10</span> <span class="comment">// 设置描边的线宽</span></span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;red&#x27;</span> <span class="comment">// 设置描边样式</span></span><br><span class="line">ctx.stroke()</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_19-32-59.png" alt="image-20200831193316894" style="zoom:33%;" />

<h3 id="填充与描边"><a href="#填充与描边" class="headerlink" title="填充与描边"></a>填充与描边</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/** <span class="doctag">@type <span class="type">&#123;HTMLCanvasElement&#125;</span> </span>*/</span></span><br><span class="line"><span class="keyword">const</span> canvas = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;canvas&#x27;</span>)</span><br><span class="line"><span class="keyword">const</span> ctx = canvas.getContext(<span class="string">&#x27;2d&#x27;</span>)</span><br><span class="line">canvas.width = <span class="number">600</span>;</span><br><span class="line">canvas.height = <span class="number">600</span>;</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">200</span>)</span><br><span class="line">ctx.closePath();</span><br><span class="line">ctx.lineWidth = <span class="number">10</span></span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;red&#x27;</span></span><br><span class="line">ctx.stroke()</span><br><span class="line">ctx.fillStyle = <span class="string">&#x27;green&#x27;</span> <span class="comment">// 设置填充样式</span></span><br><span class="line">ctx.fill()</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_19-35-06.png" alt="image-20200831193519678" style="zoom:33%;" />
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/08/31/canvas-%E9%97%AD%E5%90%88%E8%B7%AF%E5%BE%84/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/hexo/2020/08/31/canvas-%E9%97%AD%E5%90%88%E8%B7%AF%E5%BE%84/" class="post-title-link" itemprop="url">Untitled</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2020-08-31 17:11:49" itemprop="dateCreated datePublished" datetime="2020-08-31T17:11:49+08:00">2020-08-31</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2020-09-19 22:33:58" itemprop="dateModified" datetime="2020-09-19T22:33:58+08:00">2020-09-19</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/HTML/" itemprop="url" rel="index"><span itemprop="name">HTML</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h3 id="闭合路径"><a href="#闭合路径" class="headerlink" title="闭合路径"></a>闭合路径</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> canvas = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;canvas&#x27;</span>)</span><br><span class="line"><span class="keyword">const</span> ctx = canvas.getContext(<span class="string">&#x27;2d&#x27;</span>)</span><br><span class="line">canvas.width = <span class="number">600</span>;</span><br><span class="line">canvas.height = <span class="number">600</span>;</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">200</span>)</span><br><span class="line">ctx.closePath();</span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;#f00&#x27;</span> <span class="comment">// 设置颜色</span></span><br><span class="line">ctx.stroke()</span><br><span class="line"></span><br><span class="line">ctx.beginPath(); <span class="comment">// 去掉之前内存中的路径</span></span><br><span class="line">ctx.moveTo(<span class="number">100</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">200</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineTo(<span class="number">200</span>, <span class="number">200</span>)</span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;#0f0&#x27;</span></span><br><span class="line">ctx.stroke()</span><br></pre></td></tr></table></figure>

<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_17-13-20.png" alt="image-20200831162910581" style="zoom:67%;" />
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/08/31/canvas-%E7%BB%98%E5%88%B6%E5%9C%86%E5%92%8C%E7%9F%A9%E5%BD%A2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/hexo/2020/08/31/canvas-%E7%BB%98%E5%88%B6%E5%9C%86%E5%92%8C%E7%9F%A9%E5%BD%A2/" class="post-title-link" itemprop="url">canvas-绘制圆和矩形</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>
              

              <time title="Created: 2020-08-31 16:49:32 / Modified: 20:17:33" itemprop="dateCreated datePublished" datetime="2020-08-31T16:49:32+08:00">2020-08-31</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/HTML/" itemprop="url" rel="index"><span itemprop="name">HTML</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h3 id="绘制圆"><a href="#绘制圆" class="headerlink" title="绘制圆"></a>绘制圆</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> canvas = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;canvas&#x27;</span>)</span><br><span class="line"><span class="keyword">const</span> ctx = canvas.getContext(<span class="string">&#x27;2d&#x27;</span>)</span><br><span class="line">canvas.width = <span class="number">600</span>;</span><br><span class="line">canvas.height = <span class="number">600</span>;</span><br><span class="line"></span><br><span class="line">ctx.beginPath();</span><br><span class="line">ctx.arc(<span class="number">300</span>, <span class="number">300</span>, <span class="number">50</span>, <span class="number">0</span>, <span class="number">2</span>*<span class="built_in">Math</span>.PI, <span class="literal">true</span>);</span><br><span class="line">ctx.stroke()</span><br></pre></td></tr></table></figure>
<img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_16-55-41.png" alt="image-20200831165857913" style="zoom:33%;" />

<h4 id="ctx-arc参数说明"><a href="#ctx-arc参数说明" class="headerlink" title="ctx.arc参数说明"></a>ctx.arc参数说明</h4><ul>
<li>圆心横坐标</li>
<li>圆心纵坐标</li>
<li>半径</li>
<li>起始弧度</li>
<li>终止弧度</li>
<li>顺时针还是逆时针画（true代表逆时针）</li>
</ul>
<h4 id="ctx-arc的起始弧度和终止弧度对照图"><a href="#ctx-arc的起始弧度和终止弧度对照图" class="headerlink" title="ctx.arc的起始弧度和终止弧度对照图"></a>ctx.arc的起始弧度和终止弧度对照图</h4><img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_16-58-36.png"  />

<h3 id="画矩形"><a href="#画矩形" class="headerlink" title="画矩形"></a>画矩形</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> canvas = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;canvas&#x27;</span>)</span><br><span class="line"><span class="keyword">const</span> ctx = canvas.getContext(<span class="string">&#x27;2d&#x27;</span>)</span><br><span class="line">canvas.width = <span class="number">600</span>;</span><br><span class="line">canvas.height = <span class="number">600</span>;</span><br><span class="line"></span><br><span class="line">ctx.strokeRect(<span class="number">300</span>, <span class="number">100</span>, <span class="number">200</span>, <span class="number">100</span>)</span><br></pre></td></tr></table></figure>

<h4 id="strokeRect参数"><a href="#strokeRect参数" class="headerlink" title="strokeRect参数"></a>strokeRect参数</h4><ul>
<li>矩形左上角横坐标</li>
<li>矩形左上角纵坐标</li>
<li>宽</li>
<li>高</li>
</ul>
<p><strong>注：</strong> <code>strokeRect</code>函数将<code>ctx.stoke</code>封装进去了，所以我们不用调用 <code>ctx.stoke</code> 也可以绘制</p>
<h3 id=""><a href="#" class="headerlink" title=""></a></h3>
      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  

      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="en">
    <link itemprop="mainEntityOfPage" href="https://youchen12138.gitee.io/hexo/2020/08/31/canvas-%E7%BB%98%E5%88%B6%E5%A4%9A%E7%A7%8D%E9%A2%9C%E8%89%B2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.jpg">
      <meta itemprop="name" content="幽辰">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="幽辰的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          
            <a href="/hexo/2020/08/31/canvas-%E7%BB%98%E5%88%B6%E5%A4%9A%E7%A7%8D%E9%A2%9C%E8%89%B2/" class="post-title-link" itemprop="url">canvas-绘制多种颜色</a>
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>
              

              <time title="Created: 2020-08-31 16:37:05 / Modified: 20:17:36" itemprop="dateCreated datePublished" datetime="2020-08-31T16:37:05+08:00">2020-08-31</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">In</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/HTML/" itemprop="url" rel="index"><span itemprop="name">HTML</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
          <h3 id="多次stroke出现的错误"><a href="#多次stroke出现的错误" class="headerlink" title="多次stroke出现的错误"></a>多次stroke出现的错误</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> canvas = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;canvas&#x27;</span>)</span><br><span class="line"><span class="keyword">const</span> ctx = canvas.getContext(<span class="string">&#x27;2d&#x27;</span>)</span><br><span class="line">canvas.width = <span class="number">600</span>;</span><br><span class="line">canvas.height = <span class="number">400</span>;</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">200</span>)</span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;#f00&#x27;</span> <span class="comment">// 设置颜色</span></span><br><span class="line">ctx.stroke()</span><br><span class="line"></span><br><span class="line">ctx.moveTo(<span class="number">100</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">200</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineTo(<span class="number">200</span>, <span class="number">200</span>)</span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;#0f0&#x27;</span></span><br><span class="line">ctx.stroke()</span><br></pre></td></tr></table></figure>

<p>运行上面的代码后，会出现两条线，我们可以明显的看到两条线都是绿色，但第一条线有点绿中带红</p>
<p><img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_16-38-36.png" alt="image-20200831162910581"></p>
<p>在上面的代码，在第五行到第8行代码中，代码会在内存中绘制了一条路径（<strong>红色</strong>），然后执行绘制。</p>
<p>在执行到第11行到第14行的代码中，代码又会在内容中绘制一条路径（这时内存中会有两条路径），然后执行绘制，这时，就会绘制两条路径，而第一条路径因为绘制了两次（第一次为红色，第二次为绿色），所以颜色绿中带红</p>
<h3 id="正确的绘制多条颜色"><a href="#正确的绘制多条颜色" class="headerlink" title="正确的绘制多条颜色"></a>正确的绘制多条颜色</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> canvas = <span class="built_in">document</span>.getElementById(<span class="string">&#x27;canvas&#x27;</span>)</span><br><span class="line"><span class="keyword">const</span> ctx = canvas.getContext(<span class="string">&#x27;2d&#x27;</span>)</span><br><span class="line">canvas.width = <span class="number">600</span>;</span><br><span class="line">canvas.height = <span class="number">400</span>;</span><br><span class="line">ctx.moveTo(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineTo(<span class="number">100</span>, <span class="number">200</span>)</span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;#f00&#x27;</span> <span class="comment">// 设置颜色</span></span><br><span class="line">ctx.stroke()</span><br><span class="line"></span><br><span class="line">ctx.beginPath(); <span class="comment">// 去掉之前内存中的路径</span></span><br><span class="line">ctx.moveTo(<span class="number">100</span>, <span class="number">0</span>)</span><br><span class="line">ctx.lineTo(<span class="number">200</span>, <span class="number">100</span>)</span><br><span class="line">ctx.lineTo(<span class="number">200</span>, <span class="number">200</span>)</span><br><span class="line">ctx.strokeStyle = <span class="string">&#x27;#0f0&#x27;</span></span><br><span class="line">ctx.stroke()</span><br></pre></td></tr></table></figure>

<p><img src="http://blogs-images.youchen-blog.cn/Snipaste_2020-08-31_16-41-50.png" alt="image-20200831162910581"></p>

      
    </div>

    
    
    
      <footer class="post-footer">
        <div class="post-eof"></div>
      </footer>
  </article>
  
  
  


  
  <nav class="pagination">
    <a class="extend prev" rel="prev" href="/hexo/page/3/"><i class="fa fa-angle-left" aria-label="Previous page"></i></a><a class="page-number" href="/hexo/">1</a><span class="space">&hellip;</span><a class="page-number" href="/hexo/page/3/">3</a><span class="page-number current">4</span><a class="page-number" href="/hexo/page/5/">5</a><span class="space">&hellip;</span><a class="page-number" href="/hexo/page/13/">13</a><a class="extend next" rel="next" href="/hexo/page/5/"><i class="fa fa-angle-right" aria-label="Next page"></i></a>
  </nav>



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="幽辰"
      src="/hexo/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">幽辰</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/hexo/archives/">
        
          <span class="site-state-item-count">127</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/hexo/categories/">
          
        <span class="site-state-item-count">14</span>
        <span class="site-state-item-name">categories</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/hexo/tags/">
          
        <span class="site-state-item-count">23</span>
        <span class="site-state-item-name">tags</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">幽辰</span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a>
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/hexo/lib/anime.min.js"></script>
  <script src="/hexo/lib/velocity/velocity.min.js"></script>
  <script src="/hexo/lib/velocity/velocity.ui.min.js"></script>

<script src="/hexo/js/utils.js"></script>

<script src="/hexo/js/motion.js"></script>


<script src="/hexo/js/schemes/pisces.js"></script>


<script src="/hexo/js/next-boot.js"></script>




  















  

  

</body>
</html>
